<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<script src="../$$.js"></script>
<script src="../prototype/Object.js"></script>
<script src="../prototype/Array.js"></script>
<script src="../prototype/String.js"></script>
<script src="../prototype/Function.js"></script>
<script src="../Class.js"></script>
<script src="../Component.js"></script>
<script src="../util/Task.js"></script>
<script src="../util/Thread.js"></script>
<script>

/*var A = $$.Class($$.Component, {
	__initComponent: function(){
		this.addEvents(
			'e1'
			,'e2'
		);
		this.init();
	}
	,a: 1
	,b: 2
	,callE1: function(){
		if($$.VALUE_HALT === this.fireEvent('e1', [this, 2])) return;
		console.log('ssss');
	}
});
var t = {m: 111};
var a = new A({
	listeners: {
		'e1': {
			fn: function(c, t){
				console.log(c.a, t);
				return $$.VALUE_HALT;	
			}
			,scope: t
		}	
	}	
});*/

/*a.onE1(function(c, t){
	console.log(c.a, t);
	return $$.VALUE_HALT;	
}, t);*/
//a.callE1();

function updateDate(){
	if(document.getElementById('date'))
	document.getElementById('date').innerHTML = new Date();
}

function updateClock(){
	if(document.getElementById('clock')){
		var date = new Date();
		document.getElementById('clock').innerHTML = [date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()].join(':');
	}
}

var taskDate = {
	call: updateDate
};
var taskClock = {
	id: 'clock'
	,call: updateClock
	//,delay: 1	
};

var thread = new $$.util.Thread(1000, [taskDate, taskClock]);
//thread.add(taskDate).add(taskClock);
//thread.start();

//console.log($$.isObject([]));
//var task = new $$.util.Task(1000);
//task.start(function(){console.log('a');});
//var str = 'abc /sfsdf+ sfdsf{| sdfsd';
//console.log(RegExp.quote(str));
//var a = [1, 2, 3];
//console.log(Array.min(a), Array.max(a), Array.sum(a), Array.avg(a));

//console.log(str.truncate(1));*/

/*var A = $$.Class({}, {
	a: 1
	,logA: function(){
		console.log(this.a);	
	}
	,logB: function(){
		console.log(1);	
	}
	,$_final: function(){
		console.log('fff');	
	}
});
//console.log(A.__members);
//var a = new A();
//a.logA();
var B = $$.Class(A, {
	a: 2
	
	,logC: function(){
		console.log('abc');	
	}
	,constructor: function(config){
		//this.__initConstructor(config);
		console.log('a1');	
	}
	,$_final: function(){
		console.log('sss');	
	}
	,__autone: function(){
		console.log(this.a + '___');	
	}
	
});

var c = new B({
	c: 3	
});
//c.logA();
//c.logB();
//c.logC();
//console.log(c.c);
//c.$_final();
*/
</script>
</head>

<body>
<div id="date"></div>
<div id="clock"></div>
<a href="javascript:;" onclick="thread.start()">Start</a> | <a href="javascript:;" onclick="thread.stopAll()">Stop All</a> | <a href="javascript:;" onclick="thread.stop('clock')">Stop Clock</a>
</body>
</html>
